package com.schedule.task.service.impl;

import com.schedule.task.dao.BookBillMapper;
import com.schedule.task.entity.BookBill;
import com.schedule.task.service.BookBillService;
import com.schedule.task.vo.BillToUserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookBillServiceImpl implements BookBillService {


    final BookBillMapper bookBillMapper;

    @Autowired
    public BookBillServiceImpl(BookBillMapper bookBillMapper) {
        this.bookBillMapper = bookBillMapper;
    }

    @Override
    public BookBill findById(Integer id) {
        BookBill bookBill = bookBillMapper.findById(id);
        return bookBill;
    }

    @Override
    public void deleteId(Integer id) {
        bookBillMapper.deleteId(id);
    }

    @Override
    public void updateId(BookBill bookBill) {
        bookBillMapper.updateId(bookBill);
    }

    @Override
    public void insertOne(BookBill bookBill) {
        bookBillMapper.insertBookBill(bookBill);
    }

    @Override
    public void changeStatus(Integer id) {
        this.bookBillMapper.changeStatus(id);
    }

    @Override
    public List<BillToUserVo> getBillWithUser(Integer id) {
        List<BillToUserVo> billToUserVos = this.bookBillMapper.selectBillWithUser(id);
        return billToUserVos;
    }

    @Override
    public List<BookBill> searchBill(Integer setTime) {
        return this.bookBillMapper.searchBill(setTime);
    }

    @Override
    public void change(Integer id, Integer currentTime) {
        this.bookBillMapper.change(id, currentTime);
    }

}
